package com.mcx.modules.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author mcx
* @date 2022-04-30
**/
@Entity
@Data
@Table(name="channel")
public class Channel implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "status",nullable = false)
    @NotNull
    @ApiModelProperty(value = "status")
    private Integer status;

    @Column(name = "channel_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "channelId")
    private Integer channelId;

    @Column(name = "inner_version",nullable = false)
    @NotNull
    @ApiModelProperty(value = "innerVersion")
    private Integer innerVersion;

    @Column(name = "source_url",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "sourceUrl")
    private String sourceUrl;

    @Column(name = "recharge_url",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "充值回调地址")
    private String rechargeUrl;

    @Column(name = "td_app_id")
    @ApiModelProperty(value = "TD统计帐号")
    private String tdAppId;

    @Column(name = "is_open_td")
    @ApiModelProperty(value = "是否开启统计")
    private Integer isOpenTd;

    @Column(name = "pay_server_no")
    @ApiModelProperty(value = "payServerNo")
    private Integer payServerNo;

    @Column(name = "channel_status")
    @ApiModelProperty(value = "channelStatus")
    private Integer channelStatus;

    public void copy(Channel source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}